<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<body id="xiangqingPage">
<div id="xiangqingBox">
    <div class="page-title">
        <div class="page-title-con">
            <span class="pageshowtitle">详情</span>
            <div class="page-title-opt-list">
                <?php include "../public_flow/flow_show_optbut.php";?>
                <button class="layui-btn layui-btn-sm btn-light marginr5 opt">
                    操作<i class="layui-icon layui-icon-down layui-font-12"></i>
                </button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
    <div class="main-container">
        <div class="tongbox tongbox7">
            <div class="tuo">
                <div class="tit">入库单号</div>
                <div class="con" id="tong_number"></div>
            </div>
            <div class="tuo">
                <div class="tit">入库金额(元)</div>
                <div class="con" id="tong_money"></div>
            </div>
            <div class="tuo">
                <div class="tit">供应商</div>
                <div class="con" id="tong_gonger"></div>
            </div>
            <div class="tuo">
                <div class="tit">入库日期</div>
                <div class="con" id="tong_rudt"></div>
            </div>
            <div class="tuo">
                <div class="tit">项目名称</div>
                <div class="con colorlan" id="tong_enginname"></div>
            </div>
            <div class="tuo">
                <div class="tit">合同名称</div>
                <div class="con colorlan" id="tong_caiid_name"></div>
            </div>
            <div class="tuo">
                <div class="tit">合同累计入库(元)</div>
                <div class="con colorlan" id="tong_leiru"></div>
            </div>
        </div>

        <div><?php include "../public_flow/flow_show_info.php";?></div>

        <div class="table-box tablenes">
            <div class="title">基本信息</div>
            <table class="layui-table">
                <tbody>

                <tr><td class="tt">项目名称</td><td id="enginname" class="colorlan tv" colspan="3"></td></tr>
                <tr><td class="tt">入库单号</td><td id="number" colspan="3" class="tv"></td></tr>
                <tr><td class="tt">入库类型</td><td id="ishe_name" colspan="3" class="tv"></td></tr>
                <tr id="ishe_caiid" class="layui-hide"><td  class="tt">合同名称</td><td id="caiid_name" class="colorlan tv" colspan="3"></td></tr>
                <tr id="ishe_danid" class="layui-hide"><td  class="tt">关联采购单</td><td id="danid_name" class="colorlan tv" colspan="3"></td></tr>
                <tr><td class="tt">供应商</td><td id="gonger" colspan="3" class="tv"></td></tr>
                <tr><td class="tt">入库金额(元)</td><td id="money" colspan="3" class="tv"></td></tr>
                <tr><td class="tt">入库日期</td><td id="rudt" colspan="3" class="tv"></td></tr>
                <tr><td class="tt">入库人</td><td id="baner" colspan="3" class="tv"></td></tr>
                <tr><td class="tt">是否直接出库</td><td id="ischu_name" colspan="3" class="tv"></td></tr>
                <tr><td class="tt">领料人</td><td id="baner_chu" colspan="3" class="tv"></td></tr>
                <tr><td class="tt">备注</td><td id="explain" colspan="3" class="tv"></td></tr>

                </tbody>
            </table>
        </div>

        <div><?php include "../public/upinfo_show.php";?></div>

        <div><?php include "../public_flow/flow_show_flowrelas.php";?></div>

        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo">入库明细</script>
            <div class="tableShow">
                <table id="datalist" lay-filter="datalist"></table>
            </div>
        </div>



        <div><?php include '../public_flow/flow_show_shenlog.php'?></div>
        <div><?php include '../public_flow/flow_show_talk.php'?></div>
        <div><?php include '../public/opt_browse.php'?></div>
    </div>
</div>
<script>
    var param_id = getQueryVariable('id') || 0;

    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element;

        facade.ajax({url: ask_stuff_ru_show, data:{id: param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                var engininfo = res.data.engininfo;
                var caiidinfo = res.data.caiidinfo;
                var danidinfo = res.data.danidinfo;

                $("#enginname").text(engininfo.name).click(function () {
                    openPage('../engin/show.php?id='+engininfo.id);
                });






                $("#tong_number").text(data.number);
                $("#tong_money").text(parseFormatNum(data.money));
                $("#tong_gonger").text(data.gonger);
                $("#tong_rudt").text(data.rudt);
                $("#tong_enginname").text(engininfo.name).click(function () {
                    openPage('../engin/show.php?id='+engininfo.id);
                });
                $("#tong_caiid_name").text(caiidinfo.name || '').click(function () {
                    openPage('../contract_cai/show.php?id='+caiidinfo.id);
                });
                if(data.caiid > 0){
                    $("#tong_leiru").text(parseFormatNum(data.leiru)).click(function () {
                        openPage('../stuff_mingxi/tong.php?enginname='+encodeURI(engininfo.name)+'&cainame='+encodeURI(caiidinfo.name), '80%', '80%');
                    });
                }




                $("#number").text(data.number);
                $("#ishe_name").text(data.ishe_name);
                $("#type_name").text(data.type_name);
                $("#gonger").text(data.gonger);
                $("#money").text(data.money);
                $("#rudt").text(data.rudt);
                $("#baner").text(data.baner);
                if(data.ischu > 0){
                    $("#ischu_name").text('是');
                }else{
                    $("#ischu_name").text('否');
                }
                $("#baner").text(data.baner);
                $("#baner_chu").text(data.baner_chu);
                $("#explain").text(data.explain);


                if(data.ishe == 1){
                    $("#caiid_name").text(caiidinfo.name).click(function () {
                        openPage('../contract_cai/show.php?id='+caiidinfo.id);
                    });
                    $("#ishe_caiid").removeClass('layui-hide');
                }
                if(data.ishe == 2){
                    $("#danid_name").text(danidinfo.number).click(function () {
                        openPage('../stuff_cai/show.php?id='+danidinfo.id);
                    });
                    $("#ishe_danid").removeClass('layui-hide');
                }


                var mytableList = table.render({
                    elem: "#datalist",data:res.data.list, toolbar: '#toolbarDemo', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',fixed:'left'}
                        ,{field: 'name', title: '物资名称及规格'}
                        ,{field: 'unit', title: '单位'}
                        ,{field: 'price', title: '单价(元)'}
                        ,{field: 'num', title: '入库数量'}
                        ,{field: 'money', title: '入库金额(元)'}
                        ,{field: 'explain', title: '备注'}

                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });




                public_flow_show_display(res.data.billinfo);
                public_upload_show_file('upload_files', res.data.files);
                render_from();
            }
        });

        public_get_readsandlog('stuff_ru', param_id);
    });



</script>
</body>
</html>




